#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableRaidSweepEpisodeDao:DaoBase<TableRaidSweepEpisode>
    {
        public override string GetFileName()
        {
            return "TableRaidSweepEpisode.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableRaidSweepEpisode>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableRaidSweepEpisode model)
        {
            if (!cacheOneIndex.ContainsKey(model.chapterId.ToString()))
            {
                cacheOneIndex[model.chapterId.ToString()] = new List<TableRaidSweepEpisode>();
            }
            cacheOneIndex[model.chapterId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableRaidSweepEpisode model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.sweepEpisodeId)) UnityEngine.Debug.LogError("数据表id重复:TableRaidSweepEpisode->id: " + model.sweepEpisodeId);
            #endif
            cachePrimaryInt[model.sweepEpisodeId] = model;
        }
        protected override TableRaidSweepEpisode ParseRowData(string[] rowData)
        {
            TableRaidSweepEpisode data = new TableRaidSweepEpisode();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.sweepEpisodeId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.openLimitPreEpisode = ParseData<int>(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.chapterId = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.showIndex = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.showFastSweep = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.name = string.Intern(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.introIndex = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.difficulty = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.costItems = string.Intern(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.openLimitLevel = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.openExtraParams = rowData[10];
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.fightTimes = int.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.resetTimes = int.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.dropShowItems = rowData[13];
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.fightSceneId = int.Parse(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.starCondition = string.Intern(rowData[15]);
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.episedDes = string.Intern(rowData[16]);
            }
            return data;
        }
    }
}
